const mutableHandler = {
  get: function (target, k, receiver) {
    const res = Reflect.get(target, k, receiver);
    if (isObject(res)) {
      reactive(res);
    }
    console.log(res);
    return res;
  },
  set: function (target, k, value, receiver) {
    const res = Reflect.set(target, k, value, receiver);
    return res;
  },
};
function isObject(value) {
  return typeof value === "object" && value !== null;
}

function reactive(target) {
  if (isObject(target)) {
    const observe = new Proxy(target, mutableHandler);
    return observe;
  }
  return target;
}
